import { Vector2, Vector3 } from "three";
import { AK, MgrDef, ModelColor } from "../const/ModelConst";
import EntityBase from "../entity/EntityBase";
import EntityMgr from "../manager/EntityMgr";
import SceneMgr from "../manager/SceneMgr";
import MD from "../MD";
import { GeometryControlUtils } from "../utils/GeometryControlUtils";
import AMNSPEntity from "../geometry/sealplate/AMNSPEntity";
import LSPEntity from "../geometry/sealplate/LSPEntity";
import SPEntity from "../geometry/sealplate/SPEntity";
import ALAluEntity from "../geometry/aluminum/ALAluEntity";
import RAluEntity from "../geometry/aluminum/RAluEntity";
import LALAluEntity from "../geometry/aluminum/LALAluEntity";
import LRAluGeometry from "../geometry/aluminum/LRAluGeometry";
import MoldUtils from "../utils/MoldUtils";
import RChamferPGMY from "../geometry/RChamferPGMY";
import RChamferCPGMY from "../geometry/RChamferCPGMY";
import LineMouthGeo from "../geometry/LineMouthGeo";
import DorsalRidgeUtils from "../utils/DorsalRidgeUtils";
import IronUtils from "../utils/IronUtils";
import TubeUtils from "../utils/TubeUtils";
import SlotUtils from "../utils/SlotUtils";
import IrregularPlateUtil from "../utils/IrregularPlateUtil";
import yxpData from '../utils/异形平板userData.json'
export default class ModelHelper {

    static entiy: EntityBase;
    /** 获取一维缩放值 */
    static getCDValue(val: any[]): number[] {
        let result: number[] = [];
        if (val) {
            for (let i = 0; i < val.length; i++) {
                result.push(val[i]);
            }
        }
        return result;
    }

    /** 获取二维孔位值 */
    static getCDValue2(val: Vector2[]): number[][] {
        let result: number[][] = [];
        if (val) {
            for (let i = 0; i < val.length; i++) {
                if (val[i].x) {
                    result.push([val[i].x, val[i].y]);
                }
            }
        }
        return result;
    }

    /**
     * 更新下铝模板视图
     * @param vi 
     */
    static updateEntity(vi: any[], type: number): EntityBase {
        let scenemgr = MD.mgr[MgrDef.SCENE_MGR] as SceneMgr;
        let mgr = MD.mgr[MgrDef.ENTITY_MGR] as EntityMgr;

        let allmap = mgr.ALMap;

        for (let value of allmap.values()) {
            scenemgr.ds.scene.remove(value.mesh);
        }

        let entity: EntityBase = mgr.ALMap.get(type);
        if (entity) {

            entity.updateGeometry(vi[0], vi[1]);
        }
        else {
            entity = new EntityBase(vi[0], vi[1], ModelColor.TSTEEL_COLOR);
            mgr.ALMap.set(type, entity);

        }
        scenemgr.ds.scene.add(entity.mesh);

        return entity;
    }

    static updateBoard(type: number, data: any, corner: boolean = false): EntityBase {

        let vi = MoldUtils.getPlateVI(data);

        return ModelHelper.updateEntity(vi, type);
    }

    static updateSlot(type: number, data: any, wall: boolean = false): void {

        let vi = MoldUtils.getSlotVI(wall, data);

        ModelHelper.updateEntity(vi, type);
    }



    /** 外墙平板 */
    static update1(data: any): void {

        ModelHelper.updateBoard(1, data, false);

        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(0, 1000, 0)],
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)]);

    }

    /** 内墙平板 */
    static update2(data: any): void {
        ModelHelper.updateBoard(2, data, true);

        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(0, 1000, 0)],
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)]);
    }

    /** 梁侧板 */
    static update3(data: any): void {

        let entity = ModelHelper.updateBoard(3, data);
        entity.mesh.rotation.z = -Math.PI / 2;

        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, - 1000, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)]);
    }

    /** 梁底板 */
    static update4(data: any): void {
        let entity = ModelHelper.updateBoard(4, data);
        entity.mesh.rotation.x = Math.PI / 2;

        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)],
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, - 1000, 0)]);
    }

    /** 楼面板 */
    static update5(data: any): void {
        let entity = ModelHelper.updateBoard(5, data);
        entity.mesh.rotation.x = Math.PI / 2;

        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)],
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, - 1000, 0)]);
    }

    /** K板 */
    static update6(data: any): void {

        let entity = ModelHelper.updateBoard(6, data);
        entity.mesh.rotation.z = -Math.PI / 2;

        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, - 1000, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)]);
    }

    /** 墙角C槽 */
    static update7(data: any): void {
        ModelHelper.updateSlot(7, data, true);
        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(0, 1000, 0)],
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)]);
    }

    /** 普通c槽 */
    static update8(data: any): void {
        ModelHelper.updateSlot(8, data, false);
        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(0, 1000, 0)],
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)]);
    }

    /** 内转角C槽 */
    static update9(data: any): void {

        let vi = MoldUtils.getSlotCornerVI(data, false);

        ModelHelper.updateEntity(vi, 9);

        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(0, 1000, 0)],
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)]);
    }

    /** 外转角C槽 */
    static update10(data: any): void {

        let vi = MoldUtils.getSlotCornerVI(data, true);

        ModelHelper.updateEntity(vi, 10);

        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(0, 1000, 0)],
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)]);
    }

    /** 转角板/抬头板 */
    static update11(data: any): void {
        let vi = MoldUtils.getBoardCornerVI(data);
        ModelHelper.updateEntity(vi, 11);
        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(0, 1000, 0)],
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)]);
    }

    /** 飞机板 */
    static update12(data: any): void {
        let vi = MoldUtils.getBoardFlyVI(data);

        ModelHelper.updateEntity(vi, 12);

        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(0, 1000, 0)],
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)]);
    }

    /** 普通支撑 */
    static update13(data: any): void {
        let vi = MoldUtils.getBraceVI(data, 0);
        ModelHelper.updateEntity(vi, 13);

        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)],
            [new Vector3(0, 0, 0), new Vector3(0, -1000, 0)]);
    }

    /** 楼面支撑 */
    static update14(data: any): void {
        let vi = MoldUtils.getBraceFloorVI(data);
        ModelHelper.updateEntity(vi, 14);
        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)],
            [new Vector3(0, 0, 0), new Vector3(0, -1000, 0)]);
    }

    /** 梁底支撑 */
    static update15(data: any): void {
        let vi = MoldUtils.getBraceVI(data, 1);
        ModelHelper.updateEntity(vi, 15);
        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)],
            [new Vector3(0, 0, 0), new Vector3(0, -1000, 0)]);
    }

    /** 单斜铝梁 */
    static update16(data: any): void {
        let vi = MoldUtils.getBraceBeamVI(data, false);
        ModelHelper.updateEntity(vi, 16);
        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)],
            [new Vector3(0, 0, 0), new Vector3(0, -1000, 0)]);
    }

    /** 双斜铝梁 */
    static update17(data: any): void {
        let vi = MoldUtils.getBraceBeamVI(data, true);
        ModelHelper.updateEntity(vi, 17);
        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)],
            [new Vector3(0, 0, 0), new Vector3(0, -1000, 0)]);
    }

    /** 支撑托板 */
    static update18(data: any): void {

        let vi = MoldUtils.getBraceVI(data, 2);

        ModelHelper.updateEntity(vi, 18);

        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)],
            [new Vector3(0, 0, 0), new Vector3(0, 1000, 0)]);
    }

    /** 企口支撑 */
    static update19(data: any): void {
        let vi = MoldUtils.getBraceRabbetVI(data);
        ModelHelper.updateEntity(vi, 19);
        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, -1000)],
            [new Vector3(0, 0, 0), new Vector3(0, -1000, 0)]);
    }

    /** 沉箱倒角平板 */
    static update25(data: any): void {
        let vi = MoldUtils.getSectionChamferVI(data);
        ModelHelper.updateEntity(vi, 25);
        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)],
            [new Vector3(0, 0, 0), new Vector3(0, -1000, 0)]);
    }

    /** 沉箱倒角转角板 */
    static update26(data: any): void {
        let vi = MoldUtils.getSectionChamferCornerVI(data);
        ModelHelper.updateEntity(vi, 26);
        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)],
            [new Vector3(0, 0, 0), new Vector3(0, -1000, 0)]);
    }

    /** 截面异形C槽 */
    static update27(data: any): void {
        let vi = MoldUtils.getSectionSlotVI(data);

        let entity = ModelHelper.updateEntity(vi, 27);
        entity.mesh.rotation.x = Math.PI / 2;
        entity.mesh.rotation.y = Math.PI / 2;
        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(0, 1000, 0)],
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)]);
    }

    /** 截面异形平板 */
    static update28(data: any): void {
        let vi = MoldUtils.getSectionShapeVI(data);

        ModelHelper.updateEntity(vi, 28);
        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, -1000)],
            [new Vector3(0, 0, 0), new Vector3(0, -1000, 0)]);
    }

    /** L形截面异形板 */
    static update29(data: any): void {
        let vi = MoldUtils.getSectionLShapeVI(data);

        ModelHelper.updateEntity(vi, 29);
        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(0, 1000, 0)],
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)]);
    }

    /** 狗牙 */
    static update33(data: any): void {
        let vi = GeometryControlUtils.single.getStairDog(data);

        ModelHelper.updateEntity(vi, 33);
        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(0, 1000, 0)],
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)]);
    }

    /** 楼梯侧板 */
    static update37(data: any): void {
        let vi = GeometryControlUtils.single.getStairSideBoard(data);

        ModelHelper.updateEntity(vi, 37);
        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(0, 1000, 0)],
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)]);
    }

    /** 楼梯支撑 */
    static update34(data: any): void {
        let vi = GeometryControlUtils.single.getStairSupportBoard(data);


        ModelHelper.updateEntity(vi, 34);
        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(0, 1000, 0)],
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)]);
    }
    /** 楼梯转角支撑 */
    static update35(data: any): void {
        let vi = GeometryControlUtils.single.getStairConerSupportBoard(data);


        ModelHelper.updateEntity(vi, 35);
        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(0, 1000, 0)],
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)]);
    }
    /** 楼梯隔板 */
    static update38(data: any): void {
        let vi = GeometryControlUtils.single.getStairHulkhead(data);

        ModelHelper.updateEntity(vi, 38);
        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(0, 1000, 0)],
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)]);
    }
    /** 楼梯盖板 */
    static update39(data: any): void {
        let vi = GeometryControlUtils.single.getStairCoverBoard(data);


        ModelHelper.updateEntity(vi, 39);
        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(0, 1000, 0)],
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)]);
    }
    /** 楼梯挡板 */
    static update40(data: any): void {
        let vi = GeometryControlUtils.single.getStairGuardBoard(data);


        ModelHelper.updateEntity(vi, 40);
        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(0, 1000, 0)],
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)]);
    }


    /** 普通角铝*/
    static update20(data: any): void {

        let t = new ALAluEntity(0);
        let vi = t.create(data);
        ModelHelper.updateEntity([vi.vertices, vi.indices], 20);

        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(0, 1000, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)],
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)]);

    }

    /** 倒角圆弧角铝*/
    static update21(data: any): void {

        let vi = RAluEntity.__create(data);
        ModelHelper.updateEntity([vi.vertices, vi.indices], 21);

        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)],
            [new Vector3(0, 0, 0), new Vector3(0, -1000, 0)]);

    }

    /** 底角铝*/
    static update22(data: any): void {

        let t = new ALAluEntity(1);
        let vi = t.create(data);
        ModelHelper.updateEntity([vi.vertices, vi.indices], 22);

        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)],
            [new Vector3(0, 0, 0), new Vector3(0, -1000, 0)]);

    }

    /** L角铝*/
    static update23(data: any): void {

        let vi = LALAluEntity.__create(data);
        ModelHelper.updateEntity([vi.vertices, vi.indices], 23);

        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)],
            [new Vector3(0, 0, 0), new Vector3(0, -1000, 0)],
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)]);

    }

    /** 斜角铝*/
    static update24(data: any): void {

        let t = new ALAluEntity(2);
        let vi = t.create(data);
        ModelHelper.updateEntity([vi.vertices, vi.indices], 24);

        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(0, 1000, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)],
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)]);

    }

    /** 普通封板*/
    static update30(data: any): void {

        let vi = SPEntity.__create(data);
        ModelHelper.updateEntity([vi.vertices, vi.indices], 30);

        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(0, 1000, 0)],
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 0)]);

    }

    /** L封板*/
    static update31(data: any): void {

        let vi = LSPEntity.__create(data);
        ModelHelper.updateEntity([vi.vertices, vi.indices], 31);

        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(0, 1000, 0)],
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)]);

    }

    /** 角铝封板*/
    static update32(data: any): void {

        let vi = AMNSPEntity.__create(data);
        ModelHelper.updateEntity([vi.vertices, vi.indices], 32);

        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(0, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 1000, 0)]);

    }

    /** L圆弧角铝*/
    static update41(data: any): void {

        // let vi = AMNSPEntity.__create(data);
        let geo = new LRAluGeometry(data);
        let vi = geo.geometryMeta;
        ModelHelper.updateEntity([vi.vertices, vi.indices], 41);

        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)],
            [new Vector3(0, 0, 0), new Vector3(0, -1000, 0)],
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)]);

    }


    /** */
    static update42(data: any): void {

        // let vi = AMNSPEntity.__create(data);
        let geo = new RChamferPGMY(data);
        // let vi = geo.geometryMeta;
        ModelHelper.updateEntity([geo.vertices, geo.indices], 42);

        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)],
            [new Vector3(0, 0, 0), new Vector3(0, -1000, 0)],
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)]);

    }

    static update43(data: any): void {

        // let vi = AMNSPEntity.__create(data);
        let geo = new RChamferCPGMY(data);
        // let vi = geo.geometryMeta;
        ModelHelper.updateEntity([geo.vertices, geo.indices], 43);

        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)],
            [new Vector3(0, 0, 0), new Vector3(0, -1000, 0)],
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)]);

    }


    /** 放线口*/
    static update45(data: any): void {

        let geo = new LineMouthGeo(data);

        ModelHelper.updateEntity([geo.vertices, geo.indices], 45);


        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)],
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, - 1000, 0)]);

    }


    /** 传料口*/
    static update46(data: any): void {

        let geo = new LineMouthGeo(data);

        ModelHelper.updateEntity([geo.vertices, geo.indices], 46);

        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)],
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, - 1000, 0)]);

    }

    /** 背楞 */
    static update47(data: any): void {
        let vi = DorsalRidgeUtils.getDorsalRidgeVI(data);
        ModelHelper.updateEntity(vi, 47);
        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)],
            [new Vector3(0, 0, 0), new Vector3(0, 1000, 0)]);
    }

    /** 对拉螺杆 */
    static update48(data: any): void {
        let vi = IronUtils.getScrewVI(data);
        ModelHelper.updateEntity(vi, 48);

        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)],
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 1000, 0)]);
    }

    /** 蜡烛台 */
    static update49(data: any): void {
        let vi = IronUtils.getSandlestickVI(data);
        ModelHelper.updateEntity(vi, 49);
        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(0, 1000, 0)],
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)]);
    }

    /** U字码 */
    static update50(data: any): void {
        let vi = IronUtils.getUcodeVI(data);
        ModelHelper.updateEntity(vi, 50);
        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 1000, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)]);
    }

    /** L型U字码 */
    static update51(data: any): void {
        let vi = IronUtils.getLUcodeVI(data);
        ModelHelper.updateEntity(vi, 51);
        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 1000, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)]);
    }

    /** 支撑圆管 */
    static update52(data: any): void {
        let vi = IronUtils.getRoundPipeVI(data);
        ModelHelper.updateEntity(vi, 52);
        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(0, 1000, 0)],
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)]);
    }

    /** 斜支撑 */
    static update53(data: any): void {
        let vi = IronUtils.getSwayBracingVI(data);
        ModelHelper.updateEntity(vi, 53);
        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(0, 1000, 0)],
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)]);
    }

    /** 方管 */
    static update54(data: any): void {
        let vi = IronUtils.getSquareTubeVI(data);
        ModelHelper.updateEntity(vi, 54);
        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)],
            [new Vector3(0, 0, 0), new Vector3(0, 1000, 0)]);
    }

    /** L方管 */
    static update55(data: any): void {
        let vi = IronUtils.getLSquareTubeVI(data);
        ModelHelper.updateEntity(vi, 55);
        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)],
            [new Vector3(0, 0, 0), new Vector3(0, 1000, 0)]);
    }

    /** 普通角钢 */
    static update56(data: any): void {
        let vi = IronUtils.getAngleIronVI(data);
        ModelHelper.updateEntity(vi, 56);
        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)],
            [new Vector3(0, 0, 0), new Vector3(0, 1000)]);
    }

    /** 7字形角钢 */
    static update57(data: any): void {
        let vi = IronUtils.getQiAngleIronVI(data);
        ModelHelper.updateEntity(vi, 57);
        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)],
            [new Vector3(0, 0, 0), new Vector3(0, 1000)]);
    }

    /** Z字形角钢 */
    static update58(data: any): void {
        let vi = IronUtils.getZAngleIronVI(data);
        ModelHelper.updateEntity(vi, 58);
        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)],
            [new Vector3(0, 0, 0), new Vector3(0, 1000)]);
    }

    /** 几字形角钢 */
    static update59(data: any): void {
        let vi = IronUtils.getJiAngleIronVI(data);
        ModelHelper.updateEntity(vi, 59);
        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)],
            [new Vector3(0, 0, 0), new Vector3(0, 1000)]);
    }

    /** 凹字形角钢 */
    static update60(data: any): void {
        let vi = IronUtils.getAoAngleIronVI(data);
        ModelHelper.updateEntity(vi, 60);
        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)],
            [new Vector3(0, 0, 0), new Vector3(0, 1000)]);
    }


    /** 竖向背楞 */
    static update64(data: any): void {
        let vi = DorsalRidgeUtils.getDorsalRidgeVI(data);
        ModelHelper.updateEntity(vi, 64);
        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)],
            [new Vector3(0, 0, 0), new Vector3(0, 1000, 0)]);
    }

    /** 水平背楞 */
    static update65(data: any): void {
        let vi = DorsalRidgeUtils.getDorsalRidgeVI(data);
        ModelHelper.updateEntity(vi, 65);

        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)],
            [new Vector3(0, 0, 0), new Vector3(0, 1000, 0)]);
    }

    /** L底角铝*/
    static update61(data: any) {
        let vi = LALAluEntity.__create(data, 1);
        ModelHelper.updateEntity([vi.vertices, vi.indices], 61);

        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)],
            [new Vector3(0, 0, 0), new Vector3(0, -1000, 0)],
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)]);

    }

    // 2024-4-30新增

    // 编辑里面dd看原点

    /** 铝传料箱 */
    static update62(data: any) {
        let vi = MoldUtils.getLCLXVI(data);
        ModelHelper.updateEntity([vi[0], vi[1]], 62);

        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)],
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 1000, 0)]);
    }
    /** 铝盒子 */
    static update63(data: any) {
        console.log('打开铝盒子');

        let vi = MoldUtils.getLHZVI(data);
        ModelHelper.updateEntity([vi[0], vi[1]], 63);

        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)],
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 1000, 0)]);
    }
    /** 一体狗牙167 */
    static update67(data: any) {
        console.log('打开一体狗牙');
        // TODO 给ZJJ改

        let vi = GeometryControlUtils.single.getStairintegrationDog(data);

        ModelHelper.updateEntity(vi, 67);
        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(0, 1000, 0)],
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)]);
    }
    /** 拉片 */
    static update68(data: any) {
        let vi = IronUtils.getPullTabVI(data);
        ModelHelper.updateEntity([vi[0], vi[1]], 68);

        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)],
            [new Vector3(0, 0, 0), new Vector3(0, 100, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 0)]);
    }
    /** 方通扣 */
    static update69(data: any) {
        let vi = IronUtils.getSquareBuckleVI(data);
        ModelHelper.updateEntity([vi[0], vi[1]], 69);

        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)],
            [new Vector3(0, 0, 0), new Vector3(0, 1000, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 0)]);
    }
    /** 方通 */
    static update70(data: any) {
        let vi = TubeUtils.getTubeVI(data);
        ModelHelper.updateEntity([vi[0], vi[1]], 70);

        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)],
            [new Vector3(0, 0, 0), new Vector3(0, 1000, 0)]
        );
    }
    /** 异形平板 */
    static update71(data: any) {
        let userData = yxpData
        let vi = IrregularPlateUtil.getIrregularPlateVI(userData);
        ModelHelper.updateEntity([vi[0], vi[1]], 71);

        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(0, 1000, 0)],
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)],
        )
    }
    /** EC板172 */
    static update72(data: any) {
        let vi = SlotUtils.getECSlotVI(data);
        ModelHelper.updateEntity([vi[0], vi[1]], 72);

        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(0, 1000, 0)],
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)],

        );
    }
    /** 斜边C槽173 */
    static update73(data: any) {
        let vi = SlotUtils.getObliqueSlotVI(data);
        ModelHelper.updateEntity([vi[0], vi[1]], 73);

        (MD.mgr[MgrDef.SCENE_MGR] as SceneMgr).ds.updateAxes(
            [new Vector3(0, 0, 0), new Vector3(0, 1000, 0)],
            [new Vector3(0, 0, 0), new Vector3(1000, 0, 0)],
            [new Vector3(0, 0, 0), new Vector3(0, 0, 1000)],
        )
    }

}